<script setup lang="ts">
import { reactive, ref, onMounted, watch } from "vue";
import CountUp from "@/components/count-up";
import BarLeft from "@/components/bar-left/index.vue";
const duration = ref(2);

// 使用默认数据
const useDefaultData = () => {
  progressData.value = [
    {
      name: '三农中心',
      value: 25,
      color: 'linear-gradient(90deg, #7CBDCF 0%, #5287DE 100%)',
      type: 1,
      valueB: 90
    },
    {
      name: '物流园',
      value: 70,
      color: 'linear-gradient(90deg, #7CBDCF 0%, #5287DE 100%)',
      type: 1,
      valueB: 80
    },
    {
      name: '党校',
      value: 50,
      color: 'linear-gradient(90deg, #7CBDCF 0%, #5287DE 100%)',
      type: 1,
      valueB: 80
    },
    {
      name: '环保局',
      value: 60,
      color: 'linear-gradient(90deg, #7CBDCF 0%, #5287DE 100%)',
      type: 1,
      valueB: 80
    }
  ]
}
const progressData = ref<any[]>([])


</script>

<template>
  <!-- <ul class="user_Overview flex">
    <li class="user_Overview-item" style="color: #00fdfa">
      <div class="user_Overview_nums allnum">
        <CountUp :endVal="state.totalNum" :duration="duration" />
      </div>
      <p>短视频总数</p>
    </li>
    <li class="user_Overview-item" style="color: #07f7a8">
      <div class="user_Overview_nums online">
        <CountUp :endVal="state.onlineNum" :duration="duration" />
      </div>
      <p>抖音</p>
    </li>
    <li class="user_Overview-item" style="color: #e3b337">
      <div class="user_Overview_nums offline">
        <CountUp :endVal="state.offlineNum" :duration="duration" />
      </div>
      <p>小红书</p>
    </li>
    <li class="user_Overview-item" style="color: #f5023d">
      <div class="user_Overview_nums laramnum">
        <CountUp :endVal="state.alarmNum" :duration="duration" />
      </div>
      <p>蝴蝶号</p>
    </li>
  </ul> -->
  <div v-if="loading" class="loading-container">
    <div class="loading-text">数据加载中...</div>
  </div>
  <BarLeft v-else :progressData="progressData" style="width: 100%;height: 100%;padding-bottom: 40px;"></BarLeft>
</template>

<style scoped lang="less">
.left-top {
  width: 100%;
  height: 100%;
  position: relative;
}

.loading-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  
  .loading-text {
    color: #7EB7FD;
    font-size: 14px;
    text-align: center;
    animation: pulse 1.5s ease-in-out infinite;
  }
}

@keyframes pulse {
  0% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.6;
  }
}

.user_Overview {
  li {
    flex: 1;

    p {
      text-align: center;
      height: 16px;
      font-size: 16px;
    }

    .user_Overview_nums {
      width: 100px;
      height: 100px;
      text-align: center;
      line-height: 100px;
      font-size: 22px;
      margin: 50px auto 30px;
      background-size: cover;
      background-position: center center;
      position: relative;

      &::before {
        content: "";
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
      }

      &.bgdonghua::before {
        animation: rotating 14s linear infinite;
      }
    }

    .allnum {
      &::before {
        background-image: url("@/assets/img/left_top_lan.png");
      }
    }

    .online {
      &::before {
        background-image: url("@/assets/img/left_top_lv.png");
      }
    }

    .offline {
      &::before {
        background-image: url("@/assets/img/left_top_huang.png");
      }
    }

    .laramnum {
      &::before {
        background-image: url("@/assets/img/left_top_hong.png");
      }
    }
  }
}
</style>
